package com.leo.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

@Entity
@IdClass(value=com.leo.entity.ScorePK.class)
public class Score {
	@Transient
	public static int nowVersionTime(){
		return (int) (new Date().getTime()/24/60/60/1000);
	}

	//课程ID
	private String courID;
	//课程名称
	private String courName;
	//课程性质
	private String courType;
	//学分
	private String credit;
	//绩点
	private String gradePoint;
	//补考成绩
	private String makeupScore;
	//重修成绩
	private String repairScore;
	//学年
	private String schoolYear;
	//成绩
	private String score;
	private Student student;
	//学期
	private String term;

	private Integer versionTime;
	@Id
	@Column(length=20)
	public String getCourID() {
		return courID;
	}
	@Column(length=50)
	public String getCourName() {
		return courName;
	}
	@Column(length=20)
	public String getCourType() {
		return courType;
	}
	@Column(length=20)
	public String getCredit() {
		return credit;
	}
	@Column(length=20)
	public String getGradePoint() {
		return gradePoint;
	}
	@Column(length=20)
	public String getMakeupScore() {
		return makeupScore;
	}
	@Column(length=20)
	public String getRepairScore() {
		return repairScore;
	}
	@Id
	@Column(length=20)
	public String getSchoolYear() {
		return schoolYear;
	}
	@Column(length=20)
	public String getScore() {
		return score;
	}
	@Id
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="stuID")
	public Student getStudent() {
		return student;
	}
	@Id
	@Column(length=20)
	public String getTerm() {
		return term;
	}
	@Column(length=7)
	public Integer getVersionTime() {
		return versionTime;
	}
	public void setCourID(String courID) {
		this.courID = courID;
	}
	public void setCourName(String courName) {
		this.courName = courName;
	}
	public void setCourType(String courType) {
		this.courType = courType;
	}
	public void setCredit(String credit) {
		this.credit = credit;
	}
	public void setGradePoint(String gradePoint) {
		this.gradePoint = gradePoint;
	}
	public void setMakeupScore(String makeupScore) {
		this.makeupScore = makeupScore;
	}
	public void setRepairScore(String repairScore) {
		this.repairScore = repairScore;
	}
	public void setSchoolYear(String schoolYear) {
		this.schoolYear = schoolYear;
	}
	public void setScore(String score) {
		this.score = score;
	}
	public void setStudent(Student student) {
		this.student = student;
	}
	public void setTerm(String term) {
		this.term = term;
	}
	public void setVersionTime(Integer versionTime) {
		this.versionTime = versionTime;
	}
	@Override
	public String toString() {
		return "Score [courID=" + courID + ", courName=" + courName
				+ ", courType=" + courType + ", Credit=" + credit
				+ ", gradePoint=" + gradePoint + ", makeupScore=" + makeupScore
				+ ", repairScore=" + repairScore + ", schoolYear=" + schoolYear
				+ ", score=" + score + ", term=" + term + "]";
	}
}
